package com.cz.storage.service.impl;

import com.cz.storage.service.IStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

/**
 * <p>扣除库存服务接口实现</p>
 * <pre>
 * @author gitamacai
 * @date 2019/12/10 14:09
 * </pre>
 */
@Service
public class StorageServiceImpl implements IStorageService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Override
    public void deduct(String commodityCode, int count) {
        jdbcTemplate.update("update storage_tbl set count = count - ? where commodity_code = ?",
                new Object[] {count, commodityCode});

    }
}
